package com.dhc.pro.service.impl;

import com.dhc.pro.dao.UserDao;
import com.dhc.pro.pojo.User;
import com.dhc.pro.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    @Override
    public User login(User user) {
        User serchUser=userDao.login(user.getUserId());

        if (serchUser==null){
            return null;
        }else{
            if (user.getPassword().equals(serchUser.getPassword())){
                return serchUser;
            }else {
                return null;
            }
        }
    }

    @Override
    public int addUser(User user) {
        int result = userDao.addUser(user);
        return result;

    }
}
